package dao.impl;

import dao.SortDao;
import pojo.Sort;

import java.sql.SQLException;
import java.util.List;

public class SortDaoImpl extends BaseDao implements SortDao {
    @Override
    public int saveSort(Sort sort) throws SQLException {
        String sql = "insert into sort values(?,?)";
        return update(sql,sort.getCid(),sort.isPass());
    }

    @Override
    public List<Sort> getAllSort() throws SQLException {
        String sql = "select * from sort";
        return queryForList(Sort.class,sql);
    }

    @Override
    public Sort getOneSort(String cid) throws SQLException {
        String sql = "select * from sort where cid = ?";
        return queryForOne(Sort.class,sql,cid);
    }
}
